<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/3/23
  Time: 11:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>应聘管理</title>
    <script type="text/javascript" src="../script/jquery-3.2.1.js"></script>
    <link href="../css/homePage.css" rel="stylesheet" type="text/css"/>
    <script src="../script/commonFunction.js" type="text/javascript"></script>
    <script type="application/javascript" src="../script/applyManage.js"></script>
    <style type="text/css">
        #main_body {
            background-image: url("../images/bg90.jpg");
        }

        #admin_menu_div {
            padding-left: 18%;
            overflow: hidden;
            margin-top: -20px;
            border-bottom: double 2px #bbc;
        }

        #admin_menu_div_ul {
            overflow: hidden;
        }

        #admin_menu_div_ul h4 {
            position: relative;
            float: left;
            margin-right: 10%;
            border-color: #ffd8d7;
        }

        #admin_main_div div {
            width: 700px;
            margin: 30px auto;
        }

        table {
            background-color: rgba(0, 130, 230, 0.6);
        }

        table thead th {
            width: 99px;
        }

        tbody td {
            text-align: center;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#admin_main_div").children().hide();

            tick();

            $("#apply_not_look").click(function () {
                switchoverColor(this, $("#not_look_div"));
            });

            $("#apply_not_deal").click(function () {
                switchoverColor(this, $("#not_deal_div"));
            });

            $("#apply_all").click(function () {
                getApplyPageData(1);
                $("#pageUp").attr("disabled", true);
                switchoverColor(this, $("#all_apply_div"));
            });

            $("#apply_go_back").click(function () {
                if (confirm("你确定要返回首页吗！"))
                    window.location.href = "../admin/managePageJump";
            });

            $("#pageUp").click(function () {
                var pageNum = $("#pageCurrent").val();
                if (pageNum === "1") {
                    alert("当前已是第一页！");
                    $(this).attr("disabled", true);
                } else {
                    $(this).attr("disabled", false);
                    var upNum = pageNum - 1;
                    getApplyPageData(upNum);
                }
                $("#pageDown").attr("disabled", false);
            });

            $("#pageDown").click(function () {
                var cp = $("#pageCurrent").val();
                $.post("../apply/getTotalPages",
                    function (data) {
                        console.log("data = " + data);
                        if (cp == data) {
                            alert("当前已是最后一页！");
                            $(this).attr("disabled", true);
                        } else {
                            $(this).attr("disabled", false);
                            var p = parseInt(cp) + 1;
                            getApplyPageData(p);
                        }
                    });
                $("#pageUp").attr("disabled", false);
            });
        });

    </script>
</head>
<body id="main_body">
<div id="welcome">
    <c:if test="${manager != null}">
        欢迎${manager.name }登录&nbsp;&nbsp;&nbsp;<a href="../logout.action">退出</a>
    </c:if>
    <c:if test="${manager == null }">
        <%response.sendRedirect("../admin/login.jsp");%>
    </c:if>
    <span id="showTime">本地时间：<span id="localtime"></span></span>
</div>
<div id="admin_menu_div">
    <ul id="admin_menu_div_ul">
        <h4>
            <li id="apply_not_look">未查看</li>
        </h4>
        <h4>
            <li id="apply_not_deal">未处理</li>
        </h4>
        <h4>
            <li id="apply_all">全部</li>
        </h4>
        <h4>
            <li id="apply_go_back">返回</li>
        </h4>
        <h4>
            <li id="quit">退出</li>
        </h4>
    </ul>
</div>
<div id="admin_main_div">

    <div id="not_look_div">
        <table cellpadding="0" cellspacing="0" border="1px" id="myTable">
            <thead>
            <tr>
                <th colspan="6">应聘信息</th>
            </tr>
            <tr>
                <th>编号</th>
                <th>投递人</th>
                <th>投递时间</th>
                <th>是否查看</th>
                <th>是否面试</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:if test="${empty applyNotLook}">
                <tr>
                    <td colspan="6">还没有应聘消息</td>
                </tr>
            </c:if>
            <c:if test="${not empty applyNotLook}">
                <c:forEach var="ani" items="${applyNotLook}">
                    <tr>
                        <td>${ani.id}</td>
                        <td>${ani.resume.realName}</td>
                        <td>
                            <f:formatDate value="${ani.postTime}" pattern="yyyy-MM-dd"/>
                        </td>
                        <td>${ani.looked == 1 ? "已查看":"未查看"}</td>
                        <td>${ani.isInterview == 1 ? "已面试":"未面试"}</td>
                        <td>
                            <a href="../admin/goResumeDetail?uId=${ani.resume.user.id}&aId=${ani.id}"> 查看</a>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>
            </tbody>
        </table>
    </div>

    <div id="not_deal_div">
        <table cellpadding="0" cellspacing="0" border="1px" id="myTable1">
            <thead>
            <tr>
                <th colspan="6">应聘信息</th>
            </tr>
            <tr>
                <th>编号</th>
                <th>投递人</th>
                <th>投递时间</th>
                <th>是否查看</th>
                <th>是否面试</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:if test="${empty applyNotDeal}">
                <tr>
                    <td colspan="7">还没有应聘消息</td>
                </tr>
            </c:if>
            <c:if test="${not empty applyNotDeal}">
                <c:forEach var="ani" items="${applyNotDeal}">
                    <tr>
                        <td>${ani.id}</td>
                        <td>${ani.resume.realName}</td>
                        <td>
                            <f:formatDate value="${ani.postTime}" pattern="yyyy-MM-dd"/>
                        </td>
                        <td>${ani.looked == 1 ? "已查看":"未查看"}</td>
                        <td>${ani.isInterview == 1 ? "已面试":"未面试"}</td>
                        <td>
                            <a href="../admin/goResumeDetail?uId=${ani.resume.user.id}&aId=${ani.id}">查看</a>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>
            </tbody>
        </table>
    </div>

    <div id="all_apply_div">
        <input type="button" value="上一页" id="pageUp">
        <input type="text" name="currentPage" id="pageCurrent" style="width: 30px;text-align: center" readonly>
        <input type="button" value="下一页" id="pageDown">
        <table cellpadding="0" cellspacing="0" border="1px" id="myTable2">
            <thead>
            <tr>
                <th colspan="7">应聘信息</th>
            </tr>
            <tr>
                <th>编号</th>
                <th>投递人</th>
                <th>投递时间</th>
                <th>是否查看</th>
                <th>是否面试</th>
                <th>面试时间</th>
                <th>是否录用</th>
            </tr>
            </thead>
            <tbody>
            <%--<c:if test="${empty allApplySheets}">--%>
            <%--<tr>--%>
            <%--<td colspan="7">还没有应聘消息</td>--%>
            <%--</tr>--%>
            <%--</c:if>--%>
            <%--<c:if test="${not empty allApplySheets}">--%>
            <%--<c:forEach var="ani" items="${allApplySheets}">--%>
            <%--<tr>--%>
            <%--<td>${ani.id}</td>--%>
            <%--<td>${ani.resume.realName}</td>--%>
            <%--<td><f:formatDate value="${ani.postTime}" pattern="yyyy-MM-dd"/></td>--%>
            <%--<td>${ani.looked == 1 ? "已查看":"未查看"}</td>--%>
            <%--<td>${ani.isInterview == 1 ? "已面试":"未面试"}</td>--%>
            <%--<td>--%>
            <%--<c:if test="${ani.interviewDate == null}">--%>
            <%--未安排--%>
            <%--</c:if>--%>
            <%--<c:if test="${ani.interviewDate != null}">--%>
            <%--<f:formatDate value="${ani.interviewDate}" pattern="yyyy-MM-dd"/>--%>
            <%--</c:if>--%>
            <%--</td>--%>
            <%--<td>--%>
            <%--<c:if test="${ani.isEmploy == -1}">--%>
            <%--未被录用--%>
            <%--</c:if>--%>
            <%--<c:if test="${ani.isEmploy == 0}">--%>
            <%--待面试--%>
            <%--</c:if>--%>
            <%--<c:if test="${ani.isEmploy == 1}">--%>
            <%--已录用--%>
            <%--</c:if>--%>
            <%--</td>--%>
            <%--</tr>--%>
            <%--</c:forEach>--%>
            <%--</c:if>--%>
            </tbody>
        </table>
    </div>
</div>

</body>
</html>
